<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>11阻止冒泡和默认行为</title>
</head>
<body>

    <a href="https://www.baidu.com/" id="link">呵呵呵</a>


    <script src="../jquery-3.2.1.js"></script>
    <script>

        $(function(){
            $("#link").on("click", function(e){
                alert("hhh");
                // e.preventDefault(); // 阻止浏览器默认行为
                // e.stopPropagation();// 阻止事件冒泡
                return false;   // 阻止冒泡和默认行为
                
            });

            $("body").on("click", function(){
                alert("xixi");
            })
        })
    </script>


</body>
</html>